import request from '@/utils/request'

// 新增
export function alarmAdd(data = {}) {
  return request({
    url: '/jiaxing-wnj/alarm/create',
    method: 'post',
    data: data
  })
}
// 删除
export function alarmDel(data = {}) {
  return request({
    url: '/jiaxing-wnj/alarm/delete',
    method: 'get',
    params: data
  })
}
// 修改
export function alarmEdit(data = {}) {
  return request({
    url: '/jiaxing-wnj/alarm/update',
    method: 'post',
    data: data
  })
}
// 详情
export function alarmDtl(data = {}) {
  return request({
    url: '/renovation/alarm/detail',
    method: 'get',
    params: data
  })
}
// 列表
export function alarmList(data = {}) {
  return request({
    url: '/renovation/alarm/listByTenantGroup',
    method: 'get',
    params: data
  })
}

// 忽略
export function alarmIgnore(data = {}) {
  return request({
    url: '/renovation/alarm/cancel?id='+data.id,
    method: 'post',
  })
}
// 预警转事件
export function alarmTransferEvent(data = {}) {
  return request({
    url: '/jiaxing-wnj/alarm/transferEvent',
    method: 'post',
    data: data
  })
}
// 设备分类下拉
export function alarmType(data = {}) {
  return request({
    url: '/jiaxing-wnj/alarm/type',
    method: 'get',
    params: data
  })
}

// 更新关联的事件
export function updateEvent(data = {}) {
  return request({
    url: '/renovation/alarm/updateEvent',
    method: 'get',
    params: data
  })
}
// 规则编码和名称列表
export function getAlarmRuleName(data = {}) {
  return request({
    url: '/renovation/alarm-rule/names',
    method: 'get',
    params: data
  })
}

// 根据事件id查找主键id
export function getEventKey(data = {}) {
  return request({
    url: '/jiaxing-wnj/alarm/detail',
    method: 'get',
    params: data
  })
}
